﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using HtmlExtractor;
using System.Collections.Generic;
using System.Linq;
using HtmlExtractor.Output;
using System.Xml.Linq;
namespace SlTest
{
    [TestClass]
    public class XmlOutputTest:TestBase
    {
        string ExtractorFile = @"Resource/XmlExtractor.config";
        [TestMethod]
        public void OutputXaml()
        {
            string parseUri = @"http://www.lxwxw.com/files/article/html/64/64665/13022736.html";
            string textUri = @"\Resource\lxwxw\textChapter.txt";
            PageResult result = GetLoacalPageResult(parseUri, textUri);
            XDocumentOutput output = new XDocumentOutput();
            XDocument doc = XDocument.Load(@"Resource/lxwxw/xamltextchapter.xml");
            output.Template = doc;
            XDocument rdoc;
            output.TryGetOutPutResult(result,out rdoc);
        }
        //private System.Drawing.Image GetImage(string URL)
        //{
        //    HttpWebRequest Request;
        //    HttpWebResponse Response;

        //    Request = (HttpWebRequest)System.Net.WebRequest.Create(URL);
        //    Request.Referer = "http://www.lxwxw.com/xiaoshuoinfo/64/64665.html";//This header must be modified using the appropriate property or method.Parameter name: name
        //    //  Request.Headers.Add("Referer","http://www.lxwxw.com/xiaoshuoinfo/64/64665.html");
        //    Response = (HttpWebResponse)(WebResponse)Request.GetResponse();

        //    return System.Drawing.Image.FromStream(Response.GetResponseStream());

        //} 
    }
}
